/**
 * 
 */
package org.puresilk.android.net.services;

import android.app.IntentService;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

/**
 * Makes sure that queued messages are sent
 * to server as soon as a network connection 
 * has been detected.  The service is started
 * on a network not found condition in the 
 * ActionSubmissionService and lives until
 * the network is reconnected and all queued 
 * transactions have been sent to server.  It 
 * then stops itself.
 * 
 * @author david
 *
 */
public class ActionQueueService extends Service implements ActionService {
	
	public ActionQueueService(){
		super();
	}

	public IBinder onBind(Intent nt) {
		return null;
	}
	
	public int onStartCommand(Intent nt, int flags, int startId){
		// verify queue count > 0
		
		// verify no network
		
		// start watcher thread

		return 0;
	}
	

	/**
	 * Process all queued transaction.
	 */
	protected void submitQueuedTransactions(){
		
	}

	/** 
	 * reset flags, unlock queue etc.
	 */
	protected void cleanup() {
		
	}

	/**
	 * Alert UI w/ TOAST message.
	 * @param resp
	 */
	public void notifications(String msg) {
		notifications(msg,ActionService.TOAST_ALERT);
	}
	
	/**
	 * Multi-type Alert Message.
	 * @param msg
	 * @param type
	 */
	public void notifications(String msg, int type){
		if(type == ActionService.TOAST_ALERT) {
			
		}
		else {
			// type == STATUS_Alert
		}
			
	}
}
